package com.hjh.gameforum.mapper;

import com.hjh.gameforum.entity.Topic;
import com.hjh.gameforum.vo.TopicVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface TopicMapper {
    List<TopicVo> getTopics(Long categoryId,String  title);

    void createTopic(Topic topic);

    List<TopicVo> getHotTopics();

    TopicVo getTopicById(Integer id);

    void updateTopicViews(Integer id);

    void likeTopic(Integer id);

    void unlikeTopic(Integer id);

    List<TopicVo> getPinnedTopics();

    void updateTopic(Topic topic);

    @Delete("delete from topics where topic_id = #{topicId}")
    void deleteTopic(Long topicId);

    List<TopicVo> getLikeTop();

    int getTopicCountByDate(LocalDate date);

    int getTopicCountByDateRange(LocalDate begin, LocalDate end);

    int getTopicCountByMonth(int year, int month);

    Long getTotalTopics();

    List<TopicVo> getUserHomeTopics(Long userId);
}
